local deshao = fk.CreateSkill {

  name = "joy__deshao",

  tags = {  },

}



deshao:addEffect(fk.TargetConfirmed, {
  name = "joy__deshao",
  anim_type = "defensive",
  events = {fk.TargetConfirmed},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(deshao.name) and data.card.color == Card.Black  and player:usedSkillTimes(deshao.name, Player.HistoryTurn) < 2
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, deshao.name, nil, "#joy__deshao-invoke::"..data.from)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, deshao.name)
    local from = room:getPlayerById(data.from)
    if from:getHandcardNum() >= player:getHandcardNum() and  room:askForSkillInvoke(player,deshao.name,nil,"明伐：你可以弃置 %dest 一张牌::"..data.from) then
      local id = room:askForCardChosen(player, from, "he", deshao.name)
      room:throwCard(id, deshao.name, from, player)
    end
  end,
})

return deshao